package com.ycj.aop;

import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;

public class TestBeanDefinitionRegister implements ImportBeanDefinitionRegistrar {
    @Override
    public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry
            registry) {
//创建一个 bean 定义对象
        RootBeanDefinition rootBeanDefinition = new RootBeanDefinition(CustomAdvisor.class);
//把 bean 定义对象导入到容器中
        registry.registerBeanDefinition("customAdvisor", rootBeanDefinition);
    }
}